package com.ocean.elasticSearch.dao;

import java.util.List;
import java.util.concurrent.Future;

import com.ocean.elasticSearch.entity.SysLogs;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.concurrent.ListenableFuture;

public interface  ElasticLogRepository extends ElasticsearchRepository<SysLogs,Long> {
    //查询
    List<SysLogs> findByUsername(String username);

    List<SysLogs> findByDeviceType(Short deviceType);

    //计数
    Long countByUsername(String username);

    //删除
    Long deleteByUsername(String username);

    //异步查询
    @Async
    Future<SysLogs> findOneByUsername(String Username);

    @Async
    ListenableFuture<SysLogs> findOneByDeviceType(Short deviceType);

}
